import Vue from "vue";
import Router from "vue-router";
import Layout from "@/layout";
Vue.use(Router);

const base = process.env.VUE_APP_PABLICPATH;

export const menuRoutes = [
  {
    path: "/layout/factorManagement",
    component: () => import("@/views/factorManagement/index"),
    name: "factorManagement",
    meta: {
      title: "风险因子管理",
      icon: "el-icon-house" //图标
    }
  },
  {
    path: "/layout/factorRecall",
    component: () => import("@/views/factorRecall/index"),
    name: "factorRecall",
    meta: {
      title: "风险因子回溯",
      icon: "el-icon-connection" //图标
    }
  },
  {
    path: "/layout/monthTest",
    component: () => import("@/views/monthTest/index"),
    redirect: "/layout/monthTest/middleData",
    name: "monthTest",
    meta: {
      title: "月压力测试",
      icon: "el-icon-data-analysis" //图标
    },
    children: [
      {
        path: "middleData",
        component: () => import("@/views/monthTest/middleData/index"),
        name: "middleData",
        meta: {
          title: "中间数据",
          // icon: "el-icon-data-analysis" 
        }
      },
      {
        path: "/layout/monthTest/specialProject",
        component: () => import("@/views/monthTest/specialProject/index"),
        name: "specialProject",
        redirect: "/layout/monthTest/specialProject/bond",
        meta: {
          title: "专项",
          // icon: "el-icon-data-analysis" 
        },
        children: [
          {
            path: "bond",
            component: () =>
              import("@/views/monthTest/specialProject/bond/index"),
            name: "bondIndex",
            meta: {
              title: "债券",
              // icon: "el-icon-data-analysis" 
            }
          },
          {
            path: "product",
            component: () =>
              import("@/views/monthTest/specialProject/product/index"),
            name: "productIndex",
            meta: {
              title: "产品",
              // icon: "el-icon-data-analysis" 
            }
          }
        ]
      }
    ]
  },
  {
    path: "/layout/formManagement",
    component: () => import("@/views/formManagement/index"),
    redirect: "/layout/formManagement/one",
    name: "formManagement",
    meta: {
      title: "报表管理",
      icon: "el-icon-document" //图标
    },
    children: [
      {
        path: "one",
        component: () => import("@/views/formManagement/formone/index"),
        name: "one",
        meta: {
          title: "报表一",
          // icon: "el-icon-data-analysis" 
        }
      },
      {
        path: "two",
        component: () => import("@/views/formManagement/formtwo/index"),
        name: "two",
        meta: {
          title: "报表二",
          // icon: "el-icon-data-analysis" 
        }
      }
    ]
  },
  {
    path: "/layout/loggerQuery",
    component: () => import("@/views/loggerQuery/index"),
    name: "loggerQuery",
    meta: {
      title: "操作日志查询",
      icon: "el-icon-house" 
    }
  }
];

const routes = [
  {
    path: "/login",
    component: () => import("@/views/login"),
    name: "login",
    hidden: true
  },
  {
    path: "/",
    redirect: "/layout",
    component: Layout
  },
  {
    path: "/layout",
    redirect: "/layout/factorManagement",
    component: Layout,
    children: menuRoutes
  },
  {
    path: "*",
    component: () => import("@/views/nofound"),
    name: "page404",
    hidden: true
  }
];

export default new Router({
  scrollBehavior: () => ({ y: 0 }),
  base,
  routes
});
